package com.ruoyi.charge.service.impl;

import com.ruoyi.charge.domain.ChargeOrder;
import com.ruoyi.charge.mapper.OrderMapper;
import com.ruoyi.charge.service.OrderService;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public ChargeOrder addOrder(ChargeOrder chargeOrder) {
        String s = UUID.fastUUID().toString();
        chargeOrder.setOrderNumber(s.substring(15).toUpperCase());
        int i = orderMapper.addOrder(chargeOrder);
        if (i > 0) {
            return chargeOrder;
        }
        return null;
    }

    @Override
    public int updateOrder(Long orderPatientId) {
        return orderMapper.updateOrder(orderPatientId);
    }
}
